#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/rope>
#define rep(i,l,r) for(int i=(l),i##end=(r);i<=i##end;++i)
#define per(i,r,l) for(int i=(r),i##end=(l);i>=i##end;--i)
#define int long long
#define double long double
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define rbtree(way) tree<way,null_type,less<way>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
const int maxn=1e6+10,maxm=1e6+10,mod=998244353,inf=INT_MAX;
inline int ksm(int x,int k,int mod=mod){
	int ans=1;
	for(;k;k>>=1,x=x*x%mod) if(k&1) ans=ans*x%mod;
	return ans;
}

int n,a[maxn],b[maxn],ans[maxn];

signed main(){
	freopen("min.in","r",stdin),freopen("min.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n;
	rep(i,1,n) cin>>a[i];
	rep(i,1,n) cin>>b[i];
	if(n<=1e3){
		rep(i,1,n) ans[i]=inf;
		rep(i,1,n){
			int t1=inf,t2=inf;
			rep(j,i,n) t1=min(t1,a[j]),t2=min(t2,b[j]),ans[j-i+1]=min(ans[j-i+1],abs(t1-t2));
		}
		rep(i,1,n) cout<<ans[i]<<'\n';
		return 0;
	}
	else if(b[1]==1){
		int tmp=inf;
		rep(i,1,n) tmp=min(tmp,a[i]);
		rep(i,1,n) cout<<tmp-1<<'\n';
	}
	else if(b[1]==1e9){
		int tmp=0;
		rep(i,1,n) tmp=max(tmp,a[i]);
		rep(i,1,n) cout<<1000000000-tmp<<'\n';
	}
	return 0;
}
